﻿using System;
using System.Collections.Generic;
using System.IO;

class Solution
{
    /* Head ends here */
    static void nextMove(int n, int r, int c, String[] grid)
    {
        int rp = -1, cp = -1;
        for (int i = 0; i < grid.Length; ++i)
            for (int j = 0; j < grid[i].Length; ++j)
                if (grid[i][j] == 'p')
                {
                    rp = i; cp = j;
                }
        if (r < rp) Console.WriteLine("DOWN");
        else if (r > rp) Console.WriteLine("UP");
        else if (c < cp) Console.WriteLine("RIGHT");
        else Console.WriteLine("LEFT");
    }
    /* Tail starts here */
    static void Main(String[] args)
    {
        int n;

        n = int.Parse(Console.ReadLine());
        String pos;
        pos = Console.ReadLine();
        String[] position = pos.Split(' ');
        int[] int_pos = new int[2];
        int_pos[0] = Convert.ToInt32(position[0]);
        int_pos[1] = Convert.ToInt32(position[1]);
        String[] grid = new String[n];
        for (int i = 0; i < n; i++)
        {
            grid[i] = Console.ReadLine();
        }

        nextMove(n, int_pos[0], int_pos[1], grid);

    }
}